<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">

 <link rel="stylesheet" href="static/bootstrap.min.css">
  <title>极点VIP领取系统</title>
<style>
    body {
      font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
      background-color: #f0f0f0;
      display: flex;
      justify-content: center;
      align-items: center;
      height: 100vh;
      background: url("https://api.vvhan.com/api/wallpaper/pcGirl") no-repeat center center fixed;
      -webkit-background-size: cover;
      -o-background-size: cover;
      background-size: cover;
    }

   .card {
      width: 100%;
      max-width: 400px;
      padding: 30px;
      border-radius: 10px;
      background-color: #fff;
      box-shadow: 0 0 20px rgba(0, 0, 0, 0.1);
    }

   .card-title {
      font-size: 1.5rem;
      font-weight: bold;
      text-align: center;
      margin-bottom: 20px;
      color: #333;
    }

   .form-group {
      margin-bottom: 20px;
    }

    label {
      font-weight: bold;
      color: #555;
    }

    input[type="password"] {
      width: 100%;
      padding: 12px;
      border: 1px solid #ccc;
      border-radius: 5px;
      font-size: 1rem;
    }

   .btn-primary {
      width: 100%;
      padding: 12px;
      border-radius: 5px;
      font-size: 1rem;
      background-color: #007bff;
      border: none;
    }

   .btn-primary:hover {
      background-color: #0056b3;
    }

   .error {
      color: red;
      margin-top: 5px;
      font-size: 0.9rem;
    }
  </style>
</head>

<body>
  <div class="card">
    <h2 class="card-title">极点VIP领取系统</h2>
    <form action="index.php" method="post" onsubmit="return validateForm()">
      <div class="form-group">
        <label for="username">请输入账号：</label>
        <input type="text" id="username" name="username" class="form-control">
        <p class="error mt-2" id="errorMessage"></p>
      </div>
      <button type="button" class="btn btn-primary" onclick="checkUsername()">领取</button>
     <div style="text-align:center">
         技术支持：
  <a href="https://nnsvip.sbs/">极点影视</a>
</div>
    </form>
  </div>

  <script src="static/jquery.min.js"></script>
  <script>
    function validateForm() {
      var username = document.getElementById("username").value;
      if (username.trim() === "") {
        document.getElementById("errorMessage").innerHTML = "用户名不能为空！";
        return false;
      }
      return true;
    }

    function checkUsername() {
      var username = document.getElementById("username").value;
      if (!validateForm()) return;
      
      $.ajax({
        type: "POST",
        url: "api.php", // 服务器端处理AJAX请求的PHP文件
        data: {username: username},
        dataType: "json",
        success: function(response) {
          if (response) {
            document.getElementById("errorMessage").innerHTML = response.message;
          }  
        },
        error: function() {
          document.getElementById("errorMessage").innerHTML = "请求失败，请稍后再试。";
        }
      });
    }
  </script>
</body>
</html>